home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NeXTSTEP 3.1 (Developer) [x86]
/
NeXT Step 3.1 Intel dev.cdr.dmg
/
NextDeveloper
/
Examples
/
AppKit
/
Draw
/
graphicsUndo.subproj
/
PasteGraphicsChange.m
< prev
next >
Wrap
Text File
|
1992-02-09
|
2KB
|
91 lines
#import "drawundo.h"
@interface PasteGraphicsChange(PrivateMethods)
- undoDetails;
- redoDetails;
@end
@implementation PasteGraphicsChange
- initGraphicView:aGraphicView graphics:theGraphics
{
int i, count;
[super initGraphicView:aGraphicView];
graphics = [[List alloc] init];
count = [theGraphics count];
for (i = 0; i < count; i++) {
[graphics addObject:[theGraphics objectAt:i]];
}
return self;
}
- free
{
if (![self hasBeenDone])
[graphics freeObjects];
return [super free];
}
- (const char *)changeName
{
return PASTE_OPERATION;
}
- saveBeforeChange
{
return self;
}
- changeDetailClass
{
return nil;
}
- undoDetails
{
int count, i;
id graphic;
List *selectedGraphics;
List *allGraphics;
selectedGraphics = [graphicView selectedGraphics];
allGraphics = [graphicView graphics];
count = [graphics count];
for (i = 0; i < count; i++) {
graphic = [graphics objectAt:i];
[selectedGraphics removeObject:graphic];
[allGraphics removeObject:graphic];
[graphic wasRemovedFrom:graphicView];
}
[graphicView resetGroupInSlist];
return self;
}
- redoDetails
{
int count, i;
id graphic;
List *selectedGraphics;
List *allGraphics;
selectedGraphics = [graphicView selectedGraphics];
allGraphics = [graphicView graphics];
count = [graphics count];
i = count;
while (i--) {
graphic = [graphics objectAt:i];
[selectedGraphics insertObject:graphic at:0];
[allGraphics insertObject:graphic at:0];
[graphic wasAddedTo:graphicView];
if ([graphic isKindOf:[Group class]]) [graphicView setGroupInSlist:YES];
}
return self;
}
@end